home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / std / c / 323 < prev    next >
Internet Message Format  |  1996-08-06  |  1KB

  1. Path: ix.netcom.com!netnews
  2. From: miker3@ix.netcom.com (Mike Rubenstein)
  3. Newsgroups: comp.std.c
  4. Subject: Re: A question about: #define
  5. Date: Mon, 12 Feb 1996 12:25:02 GMT
  6. Organization: Netcom
  7. Message-ID: <311f3104.236842591@nntp.ix.netcom.com>
  8. References: <qug2cgc3xo.fsf@chivas.eua.ericsson.se>
  9. NNTP-Posting-Host: ix-dc10-11.ix.netcom.com
  10. X-NETCOM-Date: Mon Feb 12  4:24:48 AM PST 1996
  11. X-Newsreader: Forte Agent .99d/32.182
  12.  
  13. tobbe@erix.ericsson.se (Torbj|rn T|rnkvist) wrote:
  14.  
  15. > I'm wondering if the following preprocessor directive is 
  16. > permissible in ANSI C ?
  17. >   #define A #define B
  18. > I couldn't see from from my Harbison,Steele, "A C Reference Manual", 
  19. > if it is ok or not (gcc -ansi -pedantic accept this but the Sun 
  20. > ANSI-C compiler does not...).
  21.  
  22. It depends on what you mean.  It's legal to define A like that, but
  23. using A as a macro in your program is not.  From ISO 6.8.3.4:
  24.  
  25.     The resulting [from macro expansion] completely macro-replaced
  26.  
  27.     preprocessing token sequence is not processed as a 
  28.     preprocessing directive even if it resembles one.
  29.  
  30.  
  31. Michael M Rubenstein
  32.